<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<script src="./vue.js"></script>
	</head>
	<body>
		<div id="app">
			<!-- 事件自然传播 -->
			<div @click="todo()">
				<button type="button" @click="dothis()">键1</button>
			</div>
			<!-- 阻止事件传播 -->
			<div @click="todo()">
				<button type="button" @click.stop="dothis()">键2</button>
			</div>
			<!-- 阻止默认事件发生 -->
			<a href="http://www.runoob.com" @click.prevent="dostop">跳转</a>
			<button type="button" @click.once="add">{{num}}</button><!-- 只发生一次 -->
		</div>
		<script>
			var vm = new Vue({
				el:"#app",
				data:{
					num:0
				},
				methods:{
					todo(){
						alert("todo")
					},
					dothis(){
						alert("dothis")
					},
					dostop(){
						alert("dostop")
					},
					add(){
						return this.num++;
					}
				}
			})
		</script>
	</body>
</html>
